SPB Git forge

spb/cancerindex

Public
37commits 1branches 0releases
2.9 MBsize
maindefault branch
10 days agolast push
TypeScript 97.2% SQL 1.5% CSS 0.6% JavaScript 0.5%
1.2 KB · 27 lines tsx
Raw Blame History
1import { ogImage, OG_SIZE, OG_CONTENT_TYPE } from '@/lib/og';2import { getGeneBySymbol } from '@/lib/queries/genomics';3import { fmtInt } from '@/lib/format';45export const alt = 'CancerIndex gene page';6export const size = OG_SIZE;7export const contentType = OG_CONTENT_TYPE;8export const revalidate = 3600;910export default async function Image({ params }: { params: Promise<{ symbol: string }> }) {11  const { symbol } = await params;12  const g = await getGeneBySymbol(symbol);13  if (!g) return ogImage({ kicker: 'Gene', title: 'Gene not found', subtitle: symbol });14  const facts = [15    g.evidence_count ? { label: 'curated evidence items', value: fmtInt(g.evidence_count) } : null,16    g.variant_count ? { label: 'variants', value: fmtInt(g.variant_count) } : null,17    g.cohort_count ? { label: 'genomic cohorts', value: fmtInt(g.cohort_count) } : null,18  ].filter((f): f is { label: string; value: string } => !!f);19  return ogImage({20    kicker: `Gene${g.hgnc_id ? ` · ${g.hgnc_id}` : ''}${g.is_cancer_gene ? ' · cancer gene' : ''}`,21    title: g.symbol,22    subtitle: g.name ?? 'Curated cancer evidence, variants and cohort alteration frequencies.',23    facts,24    sourcesNote: 'HGNC · CIViC · ClinVar · GDC · cBioPortal',25  });26}27